<?php
$this->Html->addCrumb('<i class="fa fa-home"></i> ' . Inflector::camelize('Início'), '/', array('escape' => false));
$this->Html->addCrumb($product['Brand']['name'], array('controller' => 'brands', 'action' => 'view', 'slug' => $product['Brand']['slug']), array('escape' => false));
$this->Html->addCrumb($product['Category']['name'], array('controller' => 'categories', 'action' => 'view', 'slug' => $product['Category']['slug']), array('escape' => false));
$this->Html->addCrumb($product['Product']['name'], NULL, array('escape' => false));

echo $this->Html->script(array('addtocart.js'), array('inline' => false));
echo $this->Html->scriptBlock("$(document).ready(function () {

        $('#modselector').change(function () {
            $('#productprice').html($(this).find(':selected').data('price'));
            $('#modselected').val($(this).find(':selected').val());
        });

    });", array('block' => 'script'));
?>
<div class="fundo_branco">
    <h1><?php echo $product['Product']['name']; ?></h1>
    <div class="row">
        <div class="col-xs-12 col-sm-6 col-md-7">
            <?php //debug($product['ProductsImage']); ?>
            <!-- Carousel -->
            <div class="container-fluid">
                <div id="carousel_produto" class="carousel slide">
                    <div class="carousel-inner">
                        <?php
                        foreach ($product['ProductsImage'] as $key => $value) {
                            if ($key == 0) {
                                ?>
                                <div class="item active">
                                    <?php echo $this->Html->Image('/images/' . $value['image'], array('alt' => $value['image'], 'class' => 'img-thumbnail img-responsive')); ?>
                                </div>
                                <?php
                            } else {
                                ?>
                                <div class="item">
                                    <?php echo $this->Html->Image('/images/' . $value['image'], array('alt' => $value['image'], 'class' => 'img-thumbnail img-responsive')); ?>
                                </div>
                                <?php
                            }
                        }
                        ?>
                    </div>
                    <a class="left carousel-control" href="#carousel_produto" data-slide="prev">&lsaquo;</a>
                    <a class="right carousel-control" href="#carousel_produto" data-slide="next">&rsaquo;</a>
                </div>
            </div>
            <!-- /.carousel -->
            <?php //echo $this->Html->Image('/images/large/' . $product['Product']['image'], array('alt' => $product['Product']['name'], 'class' => 'img-thumbnail img-responsive'));  ?>
        </div>
        <div class="col-xs-12 col-sm-6 col-md-5">
            <strong><?php echo $product['Product']['name']; ?></strong>
            <div>
                <p><?php echo $product['Product']['description']; ?></p>
            </div>                        
            <div>
                <p><?php echo __('Brand'); ?>: <?php echo $this->Html->link($product['Brand']['name'], array('controller' => 'brands', 'action' => 'view', 'slug' => $product['Brand']['slug'])); ?></p>
            </div>                        
            <div>
                <p><?php echo __('Category'); ?>: <?php echo $this->Html->link($product['Category']['name'], array('controller' => 'categories', 'action' => 'view', 'slug' => $product['Category']['slug'])); ?></p>
            </div>                        

            <div id="productprice text-right"><h1><?php echo $this->Formatacao->moeda($product['Product']['price']); ?></h1></div>

            <div class="text-center">
                <?php echo $this->Form->create(NULL, array('url' => array('controller' => 'shop', 'action' => 'add'))); ?>
                <?php echo $this->Form->input('id', array('type' => 'hidden', 'value' => $product['Product']['id'])); ?>
                <?php if (!empty($productmodshtml)) { ?>
                    <div class="row">
                        <div class="col-sm-5">
                            <span style="font-weight:bold"><?php echo __('Product Options'); ?>:</span> <?php echo $productmodshtml; ?>
                        </div>
                    </div>
                    <input type="hidden" id="modselected" value="" />
                <?php } ?>
                <?php echo $this->Form->button(__('Add to Cart'), array('icon' => 'fa fa-shopping-cart', 'class' => 'btn btn-primary addtocart', 'id' => 'addtocart', 'id' => $product['Product']['id'])); ?>
                <?php echo $this->Form->end(); ?>
            </div>
        </div>
    </div>
</div>